package cn.cycleif.init.execute;

import cn.cycleif.init.execute.base.AbstractApplicationExecute;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;

import static cn.cycleif.init.constant.InitializeHandlerType.APPLICATION_EVENT_LISTENER;

/**
 * @Date: 25/1/17-18:53
 * @Desc:
 */
public class ApplicationStartEventListenerExecute extends AbstractApplicationExecute implements ApplicationListener<ApplicationStartedEvent> {

  public ApplicationStartEventListenerExecute(ConfigurableApplicationContext applicationContext){
    super(applicationContext);
  }

  @Override
  public void onApplicationEvent(ApplicationStartedEvent event) {
    execute();
  }

  @Override
  public String type() {
    return APPLICATION_EVENT_LISTENER;
  }
}
